<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>upload</title>
</head>
<body>
<p>
<input type="button" class="btn" id="pic1" value="上传" />
<input id="realpic1" type="hidden" />
</p>

<p>${message}</p>
<img id="showpic1" src="">


<div style="width: 100%;height: 25px;float: left;background: #fff;position: absolute;z-index: 9999;">
</div>
<form action="${base}/app/uploadFile" method="post" name="uploadForm" enctype="multipart/form-data" id="uploadForm" >
    <input name="pic" type="file" id="pic"/>
</form>

<script src="${base}/js/jquery1.10.2.min.js" ></script>
<script src="${base}/js/jquery.form.js" ></script>
<script>
    var currentPic;
    jQuery(function(){
        // 文件上传
        $(".btn").click(function(){
            currentPic = $(this)
            $("#pic").click();
        });
        $("#pic").change(function (){
            var fileName = $("#pic").val()

            // 校验商业计划书文件格式
           
            //$("#show" + currentPic.attr("id")).html($("#pic").val());
            var options = {
                success:  showResponse,  //处理完成的回调函数
                resetForm: true,
                //dataType:  'json'
            };
            $("#uploadForm").ajaxSubmit(options);

            // 按钮变成“重新上传”
            currentPic.attr("value","重新上传");
        });

    });
    function showResponse(responseText)  {
        var id = currentPic.attr("id");
        $("#show"+id).attr("src",responseText);
       
    }
</script>
</body>
</html>
